<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>时间管理-华信智原教师签课时系统</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/font/iconfont.css">
<link rel="stylesheet" type="text/css" href="css/base.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="js/kalendae/kalendae.css">
<link rel="stylesheet" type="text/css" href="css/newkalendae.css">
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/kalendae/kalendae.standalone.js"></script>
<script type="text/javascript" src="js/keshi.js"></script>

<!--包括IE9以及IE9以下的--> 
<!--[if lte IE 9]>
  <style>
  	.select-wrap:after{
    	display:none;}
    .keshi-form select{
    padding-right:1px;}
  </style>
<![endif]-->

</head>

<body>
<header>
    <div id="header-wrap">
        <div id="header" class="header-neiye">
            <h1>华信智原教师签课时系统v1.0</h1>
        </div>
    </div>
</header>
<main id="main-wrap">
	<div id="container" class="clearfix neiye">
    	<div id="admin-wrap" class="fl">
            <div class="adminschool-title">
            	<nav>
                	<ul class="clearfix">
                    	<li><a href="adminSchool.html">课程管理</a></li>
                        <li><a href="adminClass.html">班级管理</a></li>
                        <li><a href="adminRoom.html"  >教室管理</a></li>
                        <li><a href="adminTime.html" class="active">时间管理</a></li>
                        <li><a href="adminXishu.html">系数管理</a></li>
                    </ul>
                </nav>
            </div>
            <div class="adminschool-wrap">
            	<div class="add">
                    <form name="add" action="/coures/addtime" method="post">
                        <input type="text" placeholder="添加时间，比如08:45" name="title">
                        <input type="button" class="btn-add" value="添加新时间">
                    </form>
                </div>
                <form name="adminClass" action="" method="post">
                	<table width="720" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th scope="col">ID</th>
    <th scope="col">时间</th>
    <th scope="col">操作</th>
  </tr>
 
  
</table>

                </form>
            </div>
            <div class="pagebar center">
                <a href="javascript:;" class="current">1</a>
                <a href="javascript:;">2</a>
                <a href="javascript:;">3</a>
           </div>
           <!--修改教室-->
           <div class="changeAllWrap hide">
               <div class="changeWrap">
                
                    <form name="changeClass" action="" method="post">
                        <input type="text" name="title">
                        <input type="button" value="确定修改" class="btn-submit" id="btn-submitClass">
                    
                    </form>
                    <i class="iconfont icon-close"></i>
               </div>
           </div>
            
        </div>
        <aside class="fr">
        	<div id="slidebar" class="fr">
                <div id="teacher-info">
                    <div id="touxiang">
                        <a href="#"><img src="images/touxiang.jpg" alt="管理员头像"></a></div>
                    <h1 class="center">汪帆</h1>
                </div>
                <nav id="teacher-menu">
                    <div id="menulist">
                        <ul>
                            <li><a href="adminIndex.html">教师信息管理</a></li>
                            <li><a href="adminSchool.html" class="active">教务教学管理</a></li>
                            <li><a href="keshiCount.html" >课时统计管理</a></li>
                            <li><a href="adminInfo.html">管理员管理</a></li>
                             <li><a href="admindata.html">数据备份/恢复</a></li>
                              <li><a href="index.html">退出管理系统</a></li>
                        </ul>
                    </div>
                </nav>
            </div>
        </aside>
	</div>
</main>
<footer id="footer-wrap">
	<div id="footer">
    	<p>课时系统兼容IE9+、谷歌、火狐等现代浏览器，浏览器版本过低会影响用户体验</p>
    	<p>Copyright @2018成都华信智原有限公司版权所有</p>
        <p>课时系统兼容IE8+，以及谷歌、火狐等现代浏览器</p>
        <p>设计+前端开发：赵岚稹
</p>
	<p>后端开发：汪武斌</p>
    </div>
</footer>
<script>
$(function(){
    var dataCourse=[]
    var id = '';
    $.get("/coures/selectallbytime",function (res) {
      dataCourse =  res.data
        var $table=$('table');
        for(var i=0;i<dataCourse.length;i++){
            $table.append( $('<tr><td>'+dataCourse[i].id+'</td><td>'+dataCourse[i].time+'</td><td><a href="javascript:;" class="change" id="'+dataCourse[i].id+'">修改</a> <a href="javascript:;" class="del" id="'+dataCourse[i].id+'">删除</a></td></tr>'));
        }
        //删除教室
        $('.del').click(function (e) {
            var self = this;
            if (confirm('确定删除该时间吗？')) {
                $.get("/coures/deletetime/" + this.id, function (res) {
                    if (res.flag) {
                        $(self).parents('tr').remove();
                    }
                });

            }
        })

        $('.change').click(function () {
            var $content = $(this).parent().prev().text();
            id = this.id;
            changePanel($content);
        });

        $("#btn-submitClass").click(function () {
            var data = $(".changeWrap > form").serialize();
            data = data + "&id=" + id;
            $.post("/coures/updatetime", data, function (res) {
                if(res.flag){
                    window.location.reload();
                }else{
                    alert("修改失败")
                }
            })


        })
    })
    


		

    $.post("user/userinfo", function (res) {
        if(res.flag){
            $("#touxiang a img").attr("src",res.data.facIcon);
            $("#teacher-info .center").html(res.data.name)
        }else{
            window.location.href = "/"
        }
    })


    $(".btn-add").click(function () {
        var data = $(".add form").serialize();
        $.post("/coures/addtime", data, function (res) {
            if(res.flag){
                window.location.reload()
            }else{
                alert("添加失败")
            }
        })

    })


})
</script>
</body>
</html>
